package main

import (
	"errors"
	"fmt"
)

var errNotFount error = errors.New("Not found error")

func errorTest() {
	fmt.Printf("error: %v", errNotFount)
}

func panictest(){
	fmt.Println("Starting the program")
	panic(any("A severe error occurred: stopping the program!"))
	fmt.Println("Ending the program")
}

func badCall() {
	panic(any("bad end"))
}

func test() {
	defer func() {
		if e := recover(); e != any(nil){
			fmt.Printf("Panicing %s\r\n", e)
		}
	}()
	badCall()
	fmt.Printf("After bad call\r\n")
}

func recoverTest() {
	fmt.Printf("Calling test\r\n")
	test()
	fmt.Printf("Test completed\r\n")
}

func main() {
	//errorTest()
	//panictest()
	recoverTest()

}
